﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IEntityConverter.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Interface to be implemented by all entity converters.
//   Entity Converters are responsible to convert from a DataEntity into SSPListItem and from and SPListItem into a data entity
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.DataAccess.SharePoint
{
    using Microsoft.SharePoint;

    /// <summary>
    /// Interface to be implemented by all entity converters.
    /// Entity Converters are responsible to convert from a DataEntity into SSPListItem and from and SPListItem into a data entity
    /// </summary>
    /// <typeparam name="T">
    /// </typeparam>
    public interface ISPEntityConverter<T>
    {
        #region Public Methods

        /// <summary>
        /// Converts the specified data entity.
        /// </summary>
        /// <param name="dataEntity">
        /// The data entity.
        /// </param>
        /// <returns>
        /// An SPLitItem
        /// </returns>
        SPListItem Convert(T dataEntity);

        /// <summary>
        /// Converts the specified list item.
        /// </summary>
        /// <param name="listItem">
        /// The list item.
        /// </param>
        /// <returns>
        /// A Data entity
        /// </returns>
        T Convert(SPListItem listItem);

        #endregion
    }
}